//package com.api;
//
//import com.alibaba.fastjson.JSONObject;
//import com.component.service.NoteService;
//import com.system.common.Result;
//import com.system.lucene.LuceneUtils;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.apache.ibatis.annotations.Results;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.io.File;
//import java.util.List;
//import java.util.Map;
///**
// * @Classname LunceneApi
// * @Description TODO
// * @Date 2023/9/27 0:04
// * @Created by XiongXiong
// * @Author: X.I.O
// */
//@Api(tags = {"luncene搜索"})
//@RestController
//@RequestMapping("/luncene")
//public class LunceneApi {
//
//    @Autowired
//    private NoteService noteService;
//
//    @ApiOperation("索引列表")
//    @PostMapping("indexList")
//    public JSONObject indexListController(){
//        List<String> strings= LuceneUtils.getIndexList();
//        return Result.successInfo(strings);
//    }
//
//    @ApiOperation("索引创建")
//    @PostMapping("/create")
//    public JSONObject indexCreateController(@RequestParam("indexName")String indexName) throws Exception{
//        List<Map<String, Object>> mapList=noteService.listMaps();
//        LuceneUtils.addListDocumentByIndexName(indexName,mapList);
//        return Result.successInfo();
//    }
//
//    @ApiOperation("通过索引获取所有数据")
//    @PostMapping("/getAllListByIndexName")
//    public JSONObject getAllListController(@ApiParam("索引名称") @RequestParam("indexName")String indexName,
//                                           @ApiParam("属性名称")@RequestParam("field")String field,
//                                           @ApiParam("关键字")@RequestParam("keyword")String keyword,
//                                           @ApiParam("查询的条数")@RequestParam(value = "total",defaultValue = "100")Integer total) throws Exception{
//        List<Map<String, Object>> maps=LuceneUtils.searchByKeyWord(indexName,field,keyword,total);
//        return Result.successInfo(maps);
//    }
//
//    @ApiOperation("搜索")
//    @PostMapping("/searchListByIndexName")
//    public JSONObject searchByIndexName(@ApiParam("索引名称") @RequestParam("indexName")String indexName,
//                                        @ApiParam("属性名称")@RequestParam("field")String field,
//                                        @ApiParam("关键字")@RequestParam("keyword")String keyword,
//                                        @ApiParam("查询的条数")@RequestParam(value = "total",defaultValue = "100")Integer total) throws Exception{
//        List<Map<String, Object>> mapList=LuceneUtils.searchMapByKey(indexName,field,keyword,total);
//        return Result.successInfo(mapList);
//    }
//
//    @ApiOperation("模糊搜索")
//    @PostMapping("/likesearch")
//    public JSONObject likeSearchByIndexName(@ApiParam("索引名称") @RequestParam("indexName")String indexName,
//                                            @ApiParam("属性名称")@RequestParam("field")String field,
//                                            @ApiParam("关键字")@RequestParam("keyword")String keyword,
//                                            @ApiParam("查询的条数")@RequestParam(value = "total",defaultValue = "100")Integer total) throws Exception{
//        List<Map<String, Object>> mapList=LuceneUtils.likeSearch(indexName,field,keyword,total);
//        return Result.successInfo(mapList);
//    }
//}
